﻿<%@ Page Title="" Language="VB" MasterPageFile="~/AMLO/MasterPageAMLO.master" AutoEventWireup="false"
    CodeFile="Amlo1_05_9_CBS.aspx.vb" Inherits="AMLO_Amlo1_05_9_CBS" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <script type="text/javascript">
        $(document).ready(function () {
            Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
            $("input[id$=txtDateStart]").datepicker($.extend({}, $.datepicker.regional['th'], {
                yearAddToDisplay: 543,
                dateFormat: 'dd/mm/yy',
                showOn: "button",
                buttonImage: "../img/calendar.gif",
                buttonImageOnly: true
            }));

            $("input[id$=txtDateEnd]").datepicker($.extend({}, $.datepicker.regional['th'], {
                yearAddToDisplay: 543,
                dateFormat: 'dd/mm/yy',
                showOn: "button",
                buttonImage: "../img/calendar.gif",
                buttonImageOnly: true
            }));

            function EndRequestHandler(sender, args) {
                $("input[id$=txtDateStart]").datepicker($.extend({}, $.datepicker.regional['th'], {
                    yearAddToDisplay: 543,
                    dateFormat: 'dd/mm/yy',
                    showOn: "button",
                    buttonImage: "../img/calendar.gif",
                    buttonImageOnly: true
                }));

                $("input[id$=txtDateEnd]").datepicker($.extend({}, $.datepicker.regional['th'], {
                    yearAddToDisplay: 543,
                    dateFormat: 'dd/mm/yy',
                    showOn: "button",
                    buttonImage: "../img/calendar.gif",
                    buttonImageOnly: true
                }));

            }

        });

        var hasSubmitted = 0;
        function NoDoubleSubmit() {
            var divMsg = document.getElementById('Processing');
            if (hasSubmitted == 0) {
                hasSubmitted = 0;
                divMsg.style.display = 'block';
                return true;
            }
            return false;
        }

        var prm = Sys.WebForms.PageRequestManager.getInstance();

        prm.add_initializeRequest(InitializeRequest);
        prm.add_endRequest(EndRequest);

        function InitializeRequest(sender, args) {
            $get('ContentPlaceHolder1_UpdatePanel1').style.cursor = 'wait';
        }

        function EndRequest(sender, args) {
            $get('ContentPlaceHolder1_UpdatePanel1').style.cursor = 'auto';
        }

        function CheckAll(Checkbox) {
            var GridVwHeaderChckbox = document.getElementById("<%=grdAmlo.ClientID %>");
            for (i = 1; i < GridVwHeaderChckbox.rows.length; i++) {
                GridVwHeaderChckbox.rows[i].cells[15].getElementsByTagName("INPUT")[0].checked = Checkbox.checked;
            }
        }
    </script>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <table style="width: 100%;">
                <tr>
                    <td align="right" valign="top" style="width: 100px">
                        <asp:Label ID="lblDept" runat="server" CssClass="control">ฝ่าย</asp:Label>
                    </td>
                    <td align="left" valign="top" style="width: 282px">
                        <asp:DropDownList ID="ddlDepartment" runat="server" AutoPostBack="True" 
                            CssClass="control" Width="196px">
                        </asp:DropDownList>
                    </td>
                    <td align="right" valign="top">
                        <asp:Label ID="lblBranch" runat="server">ส่วนงานสาขา</asp:Label>
                    </td>
                    <td align="left" valign="top">
                        <asp:DropDownList ID="ddlBranch" runat="server" CssClass="control" Width="200px">
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td align="right" valign="top">
                        <asp:Label ID="lbltransactionDate" runat="server">วันที่ทำธุรกรรม</asp:Label>
                    </td>
                    <td align="left" valign="top">
                        <asp:TextBox ID="txtDateStart" runat="server" CssClass="control" Height="20px" Width="160px"
                            AutoCompleteType="Disabled"></asp:TextBox>
                    </td>
                    <td align="right" valign="top">
                        ถึง
                    </td>
                    <td align="left" valign="top">
                        <asp:TextBox ID="txtDateEnd" runat="server" CssClass="control" Height="20px" Width="160px"
                            AutoCompleteType="Disabled"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td align="right" valign="top">
                        <asp:Label ID="lblReportFlg" runat="server">สถานะรายงาน</asp:Label>
                    </td>
                    <td align="left" valign="top" colspan="4">
                        <asp:RadioButtonList ID="rdoReportStatus" runat="server" RepeatDirection="Horizontal">
                            <asp:ListItem Text="ทั้งหมด" Value="-1" />
                            <asp:ListItem Text="ยังไม่ตรวจสอบ" Value="" />
                            <asp:ListItem Text="รายงาน" Value="Y" />
                            <asp:ListItem Text="ไม่รายงาน" Value="N" />
                        </asp:RadioButtonList>
                    </td>
                </tr>
                <tr class="hidden">
                    <td align="right" valign="top">
                        <asp:Label ID="lblYear" runat="server">ปี</asp:Label>
                    </td>
                    <td align="left" valign="top">
                        <asp:TextBox ID="txtYear" runat="server" CssClass="control" Height="20px" Width="100px"
                            AutoCompleteType="Disabled"></asp:TextBox>
                    </td>
                    <td align="right" valign="top">
                        <asp:Label ID="lblNo" runat="server">เลขที่</asp:Label>
                    </td>
                    <td align="left" valign="top">
                        <asp:TextBox ID="txtNo" runat="server" CssClass="control" Height="20px" Width="160px"
                            AutoCompleteType="Disabled"></asp:TextBox>
                    </td>
                    <td align="right" valign="top">
                        &nbsp;
                    </td>
                    <td align="left" valign="top">
                        &nbsp;
                    </td>
                </tr>
                <tr class="hidden">
                    <td align="right" valign="top">
                        สถานะ
                    </td>
                    <td align="left" valign="top">
                        <asp:RadioButtonList ID="rdolIsComplete" runat="server" RepeatDirection="Horizontal">
                            <asp:ListItem Value="-1">ทั้งหมด</asp:ListItem>
                            <asp:ListItem Value="1">ครบถ้วน</asp:ListItem>
                            <asp:ListItem Value="0">ไม่ครบถ้วน</asp:ListItem>
                        </asp:RadioButtonList>
                    </td>
                    <td align="right" valign="top">
                        <asp:Label ID="lblDelete" runat="server" Text="สถานะการลบ"></asp:Label>
                    </td>
                    <td align="left" valign="top" colspan="3">
                        <asp:RadioButtonList ID="rdoDelete" runat="server" RepeatDirection="Horizontal">
                            <asp:ListItem Value="0">ทั้งหมด</asp:ListItem>
                            <asp:ListItem Value="1">ขอลบ</asp:ListItem>
                            <asp:ListItem Value="2">ยืนยันลบ</asp:ListItem>
                        </asp:RadioButtonList>
                        <asp:CheckBox ID="ChkIsDelete" runat="server" Text="ขอลบ" />
                    </td>
                </tr>
                <tr>
                    <td colspan="6" style="text-align: right">
                        <asp:Button ID="btnSearch" runat="server" CssClass="control" Text="ค้นหา" Width="80px" />
                        <asp:Button ID="btnVerify" runat="server" CssClass="control" Text="ตรวจสอบแล้ว" Width="100px" />
                        <asp:Button ID="btnPrint" runat="server" CssClass="control" Text="ออกรายงาน" Width="100px" />
                    </td>
                </tr>
                <tr>
                    <td colspan="6" style="text-align: center"> 
                        <span id="Processing" style="display: none">
                            <img src="../img/icon/ajax-loader.gif" alt="Please wait" />
                            กรุณารอสักครู่ ระบบกำลังค้นหาข้อมูล... </span>
                    </td>
                </tr>
                <tr>
                    <td colspan="6" style="text-align: center">
                        <asp:Label ID="lblMsg" runat="server" CssClass="control" Font-Bold="True" Font-Size="XX-Large"
                            ForeColor="Red" Height="35px" Text="ไม่พบข้อมูล" Visible="False" Width="170px"></asp:Label>
                     </td>
                </tr>
                <tr>
                    <td colspan="6">
                        <asp:GridView ID="grdAmlo" runat="server" AutoGenerateColumns="False" CellPadding="4"
                            ForeColor="#333333" Style="margin-right: 0px; margin-bottom: 0px;" Width="100%"
                            AllowPaging="True">
                            <RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
                            <Columns>
                                <asp:CommandField ButtonType="Image" SelectImageUrl="~/img/icon/select_icon.gif"
                                    ShowSelectButton="True">
                                    <ItemStyle Width="60px" />
                                </asp:CommandField>
                                <asp:BoundField DataField="P3_TRANS_DATE" DataFormatString="{0:d}" 
                                    HeaderText="วันที่ทำธุรกรรม" ItemStyle-HorizontalAlign="Center" />
                                <asp:TemplateField HeaderText="ประเภทธุรกรรม">
                                    <ItemTemplate>
                                        <asp:Label ID="lblTransCode" runat="server" Text='<%# "(" & eval("KEY_FLG") & ") " & eval("P3_TRAN_CODE") %>' CssClass="control" />
                                    </ItemTemplate>
                                    <ItemStyle HorizontalAlign="Center" Width="120px" />
                                </asp:TemplateField>
                                <asp:BoundField DataField="INIT_SOL_ID" HeaderText="SOL_ID">
                                    <ItemStyle HorizontalAlign="Center" />
                                </asp:BoundField>
                                <asp:BoundField DataField="P3_TRAN_ID" HeaderText="Transaction ID">
                                    <ItemStyle HorizontalAlign="Center" />
                                </asp:BoundField>
                                <asp:TemplateField HeaderText="ผู้โอน">
                                    <ItemTemplate>
                                        <asp:Label ID="lblSendAcid" runat="server" Text='<%# "เลขที่บัญชี : " & eval("P3_FORACID")%>'></asp:Label>
                                        <br />
                                        <asp:Label ID="lblSendName" runat="server" 
                                            Text='<%# "ชื่อ : " & eval("P3_CUST_NAME") %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="ผู้รับโอน">
                                    <ItemTemplate>
                                        <asp:Label ID="lblReceiveAcid" runat="server" Text='<%# "เลขที่บัญชี : " & eval("P3_FORACID2")%>'></asp:Label>
                                        <br />
                                        <asp:Label ID="lblReceiveName" runat="server" 
                                            Text='<%# "ชื่อ : " & eval("P3_CUST_NAME2") %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:BoundField DataField="P3_TRAN_AMT" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right"
                                    HeaderText="จำนวนเงิน" />
                                <asp:BoundField DataField="CBS_REPORT_FLG" HeaderText="รายงาน">
                                    <ItemStyle HorizontalAlign="Center" Width="80px" />
                                </asp:BoundField>
                                <%--<asp:BoundField DataField="CBS_FULL_RPTNO" HeaderText="เลขที่รายงาน">
                                    <ItemStyle HorizontalAlign="Center" Width="80px" />
                                </asp:BoundField>--%>
                                <asp:BoundField DataField="CBS_MAPBY" HeaderText="ผู้ตรวจสอบ">
                                    <ItemStyle HorizontalAlign="Center" Width="80px" />
                                </asp:BoundField>
                                <asp:TemplateField>
                                    <ItemTemplate></ItemTemplate>
                                    <HeaderStyle BackColor="Black" Width=" 5px" BorderColor="Black" />
                                    <ItemStyle BackColor="Black" Width="5px" BorderColor="Black" />
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="VER/SEND">
                                    <ItemTemplate>
                                        <asp:Label ID="Label2" runat="server" Text='<%# eval("RPTREV") %>'></asp:Label>
                                        <asp:Label ID="Label7" runat="server" Text="/"></asp:Label>
                                        <asp:Label ID="Label8" runat="server" 
                                            Text='<%# iif(eval("issend")=false," ","Y") %>'></asp:Label>
                                    </ItemTemplate>
                                    <ItemStyle HorizontalAlign="Center" />
                                </asp:TemplateField>
                                <asp:BoundField DataField="P3_TRANS_DATE" DataFormatString="{0:d}" 
                                    HeaderText="วันที่ทำธุรกรรม" ItemStyle-HorizontalAlign="Center" />
                                <asp:TemplateField HeaderText="ประเภทธุรกรรม">
                                    <ItemTemplate>
                                        <asp:Label ID="lblTransCode" runat="server" Text='<%# "(" & eval("KEY_FLG") & ") " & eval("P3_TRAN_CODE") %>' CssClass="control" />
                                    </ItemTemplate>
                                    <ItemStyle HorizontalAlign="Center" Width="120px" />
                                </asp:TemplateField>
                                <asp:BoundField DataField="INIT_SOL_ID" HeaderText="SOL_ID">
                                    <ItemStyle HorizontalAlign="Center" />
                                </asp:BoundField>
                                <asp:TemplateField HeaderText="เลขที่เอกสาร">
                                    <ItemTemplate>
                                        <asp:HiddenField ID="hdfId" runat="server" Value='<%# eval("ID") %>' />
                                        <asp:Label ID="lblDocNo" runat="server" Text='<%# eval("DCN_DOCUMENTNO") %>'></asp:Label>
                                    </ItemTemplate>
                                    <ItemStyle HorizontalAlign="Center" />
                                </asp:TemplateField>
                                <asp:BoundField DataField="P3_TRAN_ID" HeaderText="Transaction ID">
                                    <ItemStyle HorizontalAlign="Center" />
                                </asp:BoundField>
                                <asp:TemplateField HeaderText="ผู้โอน">
                                    <ItemTemplate>
                                        <asp:Label ID="lblSendAcid" runat="server" Text='<%# "เลขที่บัญชี : " & eval("P3_FORACID")%>'></asp:Label>
                                        <br />
                                        <asp:Label ID="lblSendName" runat="server" 
                                            Text='<%# "ชื่อ : " & eval("P3_CUST_NAME") %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="ผู้รับโอน">
                                    <ItemTemplate>
                                        <asp:Label ID="lblReceiveAcid" runat="server" Text='<%# "เลขที่บัญชี : " & eval("P3_FORACID2")%>'></asp:Label>
                                        <br />
                                        <asp:Label ID="lblReceiveName" runat="server" 
                                            Text='<%# "ชื่อ : " & eval("P3_CUST_NAME2") %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:BoundField DataField="P3_TRAN_AMT" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right"
                                    HeaderText="จำนวนเงิน" />
                                <asp:TemplateField HeaderText="สาขายืนยัน">
                                    <ItemTemplate>
                                        <asp:Label ID="lblIsUserConfirm" runat="server" 
                                            Text='<%# iif(eval("isconfirm")="0","-","") & iif(eval("isconfirm")="1","Y","") %>'></asp:Label>
                                    </ItemTemplate>
                                    <ItemStyle HorizontalAlign="Center" />
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="ผู้บันทึก">
                                    <ItemTemplate>
                                        <asp:Label ID="Label5" runat="server" 
                                            Text='<%# iif(isDBNull(eval("UpdateBy")),eval("CreateBy"),eval("UpdateBy")) %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                            </Columns>
                            <FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
                            <PagerSettings Mode="NumericFirstLast" />
                            <PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" CssClass="cssPager" />
                            <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" />
                            <HeaderStyle BackColor="#FF9933" Font-Bold="True" ForeColor="White" />
                            <AlternatingRowStyle BackColor="White" />
                        </asp:GridView>
                    </td>
                </tr>
            </table>
            <div align="right">
                <asp:Label ID="lblTotal" runat="server" Font-Bold="True" ForeColor="#003300"></asp:Label>
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
